/*1.按键布局要求整齐合理
2. 使用控件QLineEdit，QPushButton*/
#include "mainWindow.h"
#include <QDebug>

mainWindow::mainWindow(QWidget * parent,Qt::WindowFlags f)
:QWidget(parent,f)
{
    this->layout=new QVBoxLayout(this);
    this->lineEdit1=new QLineEdit(this);
    this->lineEdit2=new QLineEdit(this);
    this->lineEdit3=new QLineEdit(this);
    this->layout->addWidget(lineEdit1);
    this->layout->addWidget(lineEdit2);
    this->layout->addWidget(lineEdit3);
    
    this->layout1=new QHBoxLayout(this);
    this->pushButton1=new QPushButton(this);
    this->pushButton2=new QPushButton(this);
    this->pushButton3=new QPushButton(this);
    this->pushButton4=new QPushButton(this);
    this->pushButton1->setText("1");
    this->pushButton2->setText("2");
    this->pushButton3->setText("3");
    this->pushButton4->setText("+");
    this->layout1->addWidget(pushButton1);
    this->layout1->addWidget(pushButton2);
    this->layout1->addWidget(pushButton3);
    this->layout1->addWidget(pushButton4);
    this->layout->addLayout(layout1);
    
    this->layout2=new QHBoxLayout(this);
    this->pushButton5=new QPushButton(this);
    this->pushButton6=new QPushButton(this);
    this->pushButton7=new QPushButton(this);
    this->pushButton8=new QPushButton(this);
    this->pushButton5->setText("4");
    this->pushButton6->setText("5");
    this->pushButton7->setText("6");
    this->pushButton8->setText("-");
    this->layout2->addWidget(pushButton5);
    this->layout2->addWidget(pushButton6);
    this->layout2->addWidget(pushButton7);
    this->layout2->addWidget(pushButton8);
    this->layout->addLayout(layout2);

    this->layout3=new QHBoxLayout(this);
    this->pushButton9=new QPushButton(this);
    this->pushButton10=new QPushButton(this);
    this->pushButton11=new QPushButton(this);
    this->pushButton12=new QPushButton(this);
    this->pushButton9->setText("7");
    this->pushButton10->setText("8");
    this->pushButton11->setText("9");
    this->pushButton12->setText("*");
    this->layout3->addWidget(pushButton9);
    this->layout3->addWidget(pushButton10);
    this->layout3->addWidget(pushButton11);
    this->layout3->addWidget(pushButton12);
    this->layout->addLayout(layout3);

    this->layout4=new QHBoxLayout(this);
    this->pushButton13=new QPushButton(this);
    this->pushButton14=new QPushButton(this);
    this->pushButton15=new QPushButton(this);
    this->pushButton16=new QPushButton(this);
    this->pushButton13->setText("C");
    this->pushButton14->setText("0");
    this->pushButton15->setText("=");
    this->pushButton16->setText("/");
    this->layout4->addWidget(pushButton13);
    this->layout4->addWidget(pushButton14);
    this->layout4->addWidget(pushButton15);
    this->layout4->addWidget(pushButton16);
    this->layout->addLayout(layout4);

    this->setLayout(layout);

}